package com.corewillsoft.fireflies.gameobjects;

import java.util.Arrays;
import java.util.List;

import android.util.Log;

import com.corewillsoft.fireflies.app.GameEngineConstants;
import com.corewillsoft.fireflies.gamelaws.LawType;
import com.corewillsoft.fireflies.gameobjects.fireflyraces.Color;
import com.corewillsoft.fireflies.gameobjects.fireflyraces.RaceType;

public class Portal extends GameObject {

	public enum PortalType {
		NORMAL
	}

	private final static List<LawType> supportedLaws = Arrays.asList();
	private final static List<LawType> createdLaws = Arrays.asList(LawType.PORTAL_FIREFLY);

	private PortalType type;
	private RaceType raceType;

	public Portal(int x, int y, RaceType type) {
		super(x, y);
		super.setWidth(GameEngineConstants.DEFAULT_PORTAL_SIZE);
		super.setHeight(GameEngineConstants.DEFAULT_PORTAL_SIZE);
		raceType = type;
		initRaceType(type);
	}

	private void initRaceType(RaceType raceType) throws NullPointerException {
		Color color = raceType.getPortalColor();
		setColor(color.getRed(), color.getGreen(), color.getBlue());
	}

	public RaceType getRace() {
		return raceType;
	}

	public void setRaceType(RaceType raceType) {
		this.raceType = raceType;
	}

	public PortalType getType() {
		return type;
	}

	public void setType(PortalType type) {
		this.type = type;
	}

	public void setType(int type) {
		this.type = PortalType.values()[type];
	}

	@Override
	public void updateState() {
		Log.d("Portal", "I'm not moving...");
	}

	@Override
	public boolean isActive() {
		return true;
	}

	@Override
	protected List<LawType> getSupportedLaws() {
		return supportedLaws;
	}

	@Override
	protected List<LawType> getCreatedLaws() {
		return createdLaws;
	}

}
